UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OIQJgIds7991JRKgwtYyNn7Y1IsDrdGuPT9KPpthsrY=' 
WHERE 
  key_id = '55a6906aee4da797a9e8b01311a8adfff3992e4fec80ea0a6cabf1d583fccbef' 
  AND (
    token = 'OIQJgIds7991JRKgwtYyNn7Y1IsDrdGuPT9KPpthsrY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032