UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DSlTR0hBWydxdqFmZS1+d1wviXW9C8ti3CMJh5/afbU='
WHERE
key_id = 'fd13a2fabc301cf3ad75dbca9c0a1f432162215179c49223b4a71ec2850acdbe'
AND (
token = 'DSlTR0hBWydxdqFmZS1+d1wviXW9C8ti3CMJh5/afbU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)