UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Idxfr1I80k5Naduc3TgF7oPt2mskhaBaxuJGQ7Ld8jg='
WHERE
key_id = '1d7b93350e82091b8890152e0cf9daf4ad4094e94b65db20376493240a9abd0a'
AND (
token = 'Idxfr1I80k5Naduc3TgF7oPt2mskhaBaxuJGQ7Ld8jg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)