UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QieBfbH37W8bff/izrnV+qx2f3Pd3BcnXfKt+nnZHq8='
WHERE
key_id = '67a8a349ff96cd4cccb0e7e96fa9bccb63b99792597f3b80ee29ea097c5695bf'
AND (
token = 'QieBfbH37W8bff/izrnV+qx2f3Pd3BcnXfKt+nnZHq8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)