UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4AQLmiew3yXwbyyhosiEkYdk5S3avy0p1hXvZAEWYe0=' 
WHERE 
  key_id = 'ca379e0b770afd8cc5bbc9417aced97f82ba337a9f96d48b2a983e9143a20bda' 
  AND (
    token = '4AQLmiew3yXwbyyhosiEkYdk5S3avy0p1hXvZAEWYe0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040