UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3fy99GR3GPCgQdypmz1ylnTBYSXQVvFtYl5H7bVmSTY='
WHERE
key_id = '3978eb69ded2cc56523fef5b02c6cac03dd3e95f9bf414a3f3fbfd02e17f72c2'
AND (
token = '3fy99GR3GPCgQdypmz1ylnTBYSXQVvFtYl5H7bVmSTY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)