UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GrfTKk4sBh0qQgOOA+o8bbz2A4uX7zdPTEcelB5hizw='
WHERE
key_id = 'a42a3a4a0fcad93ae1bcfdfcfa32204196d982dbf0201736058c392ce9801e17'
AND (
token = 'GrfTKk4sBh0qQgOOA+o8bbz2A4uX7zdPTEcelB5hizw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)