UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z6ZQ3sv3Xxf4f2hUfgMF/cPsCmBxuzdOw3KIV0LsZO4='
WHERE
key_id = 'f7577954772c1b1200ef0cb16fafad4f531e95c55eeaa22bbd282dda157e8c0d'
AND (
token = 'Z6ZQ3sv3Xxf4f2hUfgMF/cPsCmBxuzdOw3KIV0LsZO4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)