UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'F89pTQSlmM0FQKADrg8Q2tvqGzkapYuQinb0w/accH4='
WHERE
key_id = '3f123d41b7a6e98c959f128577d48fed7a82f38707fb1dd4ef574409a054c2eb'
AND (
token = 'F89pTQSlmM0FQKADrg8Q2tvqGzkapYuQinb0w/accH4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)