UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QkOAkvjO2IhsGsGPhXxF/AZVl9DR5n2jW571aMdU2pw='
WHERE
key_id = 'c9d5e3a90614800af1287f0faa085e51e339af3ea8b3d2d77847b81e7c22a7a3'
AND (
token = 'QkOAkvjO2IhsGsGPhXxF/AZVl9DR5n2jW571aMdU2pw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)