UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4nKkzgTPjWdLTNhzWcoajSo0dW40xvLMgo5cXExkYYs='
WHERE
key_id = '27137b5ce3462352bad55cae461262c51e1e3e3fb45cb494ba769b5bcd405eb8'
AND (
token = '4nKkzgTPjWdLTNhzWcoajSo0dW40xvLMgo5cXExkYYs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)