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