UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xo5Kmx6t0EKcfpUHNOnsAruHo7LUbb2pv40bXKRuSbU='
WHERE
key_id = 'ff3b84bbc70dfc13d59e74f35df8107566075329d5b4737e7b41744e197b6c14'
AND (
token = 'xo5Kmx6t0EKcfpUHNOnsAruHo7LUbb2pv40bXKRuSbU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)