UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tbO7RJqJ8t/sJY5CudwXRBxPhGXmg93HfASODLqrcoU='
WHERE
key_id = '287b192b963959fc8495ae451e010b0be89905c2098fde4a5d039d0c4163fd3e'
AND (
token = 'tbO7RJqJ8t/sJY5CudwXRBxPhGXmg93HfASODLqrcoU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)