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