UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0THIopyXF32RPw7y7/0UzJ4D+hubN6YA1xqU8nb6tNs=' 
WHERE 
  key_id = '78b0035290982a4f0d7968bfbc55fd8debff18c1b0792a69fc57ede496b1f328' 
  AND (
    token = '0THIopyXF32RPw7y7/0UzJ4D+hubN6YA1xqU8nb6tNs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037