UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Kp9hcIuXLH/v++/Dcnt6NUKP3YFrFZVLxb6MCX247+8='
WHERE
key_id = 'ddd5c2a9e430c598bf1e48e98ac77a1d360a0dc167852995cd4de9b3040cf906'
AND (
token = 'Kp9hcIuXLH/v++/Dcnt6NUKP3YFrFZVLxb6MCX247+8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)