UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KIBWWFQiOWCRmm1TuVv94vUz2JGyrUgyB1igGTykK78='
WHERE
key_id = 'd47c18af18a1bc315e7544c6c2cbb8bf5331a678d977ce980289d4a366a17414'
AND (
token = 'KIBWWFQiOWCRmm1TuVv94vUz2JGyrUgyB1igGTykK78='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)