UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U4uOQfHM67NdpDq7sdmtzqD0QRHSr6dLB/manyfpYiA=' 
WHERE 
  key_id = 'e8c5520f131c63e826156d55c463b554edb4f443a0535d3a8c0f5f9240ec2231' 
  AND (
    token = 'U4uOQfHM67NdpDq7sdmtzqD0QRHSr6dLB/manyfpYiA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044