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