UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XKc8b00TnAqMHIH4pjfgv5W8DYE6uefqgZglCU5ci5M='
WHERE
key_id = '571f4ce53cf15512bacb3271ac0b7ce0826a4b5367eeec3a08f0a7f7d42d5835'
AND (
token = 'XKc8b00TnAqMHIH4pjfgv5W8DYE6uefqgZglCU5ci5M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)