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