UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rr8DDaEv6wExMPZOqHErfwH8f3bGDrSMGjKUizEx5Yw='
WHERE
key_id = '10e6c387934be2e379b9d03864b3295fd2b2fdcbdcb8cb6c7ec1ed80c2e79d8b'
AND (
token = 'rr8DDaEv6wExMPZOqHErfwH8f3bGDrSMGjKUizEx5Yw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)