UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r8sZROrmwJA12UMzlG+Eusd2j0m1pCgvaKSPfVF80oU='
WHERE
key_id = 'e47ec1a28c70158d1a61fde127b0bf61ddf455150784e492e79a50a8fcff0e05'
AND (
token = 'r8sZROrmwJA12UMzlG+Eusd2j0m1pCgvaKSPfVF80oU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)