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