UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KqU+lQZuE3jIlOD26HyPrbTb9iWR2S9DOADwYDOAQQ8='
WHERE
key_id = 'e7a4e939cf217d7898421dc87b8faab895327616c3fda3d1bd8597d65abcede7'
AND (
token = 'KqU+lQZuE3jIlOD26HyPrbTb9iWR2S9DOADwYDOAQQ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)