UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gmHBz13vyVneeRYdk6TbgdnZHSW9mlE0h/pp27Cya/A='
WHERE
key_id = 'b02316e8ad93510b30e6825eb74ce47e791deaba2027ba8f0658f59a52b707c7'
AND (
token = 'gmHBz13vyVneeRYdk6TbgdnZHSW9mlE0h/pp27Cya/A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)