UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CvyPCBYiMKAQijD1LvdnXZ9zPDFZmY9DE7q1zvgVTfE='
WHERE
key_id = '9f077f053c990aed0837b84feec5bd4169bc0a7d060c704b158cf4ef786f19ba'
AND (
token = 'CvyPCBYiMKAQijD1LvdnXZ9zPDFZmY9DE7q1zvgVTfE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)