UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Lm1Hcn6zCh1f4O1PqdxaRPYkW7pSvD7+aCqfdFXB8Fk='
WHERE
key_id = '6cc47d9dd9c655d491407cf1ef9442895dc2e201364254806daedb75df801e48'
AND (
token = 'Lm1Hcn6zCh1f4O1PqdxaRPYkW7pSvD7+aCqfdFXB8Fk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)