UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'l2uK59kHWLxfSMcPAWMjHrnUf7PSg1YkXPZKuP+k0Yk='
WHERE
key_id = 'dfdc6412b143e620975a9c8a9faa1638a0d23c7bafbe8ff0742163272b4b1a2f'
AND (
token = 'l2uK59kHWLxfSMcPAWMjHrnUf7PSg1YkXPZKuP+k0Yk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)