UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SbvA+4IuURcXTtvORLaRiR8N8jqLqfVjoFzPsV2M2mc='
WHERE
key_id = 'f9a02c5c2d6bf251616992a0451100a49a6d847137ced674997e129d34338ee7'
AND (
token = 'SbvA+4IuURcXTtvORLaRiR8N8jqLqfVjoFzPsV2M2mc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)