UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dlRuebbeTk8uebUpmHvPdos418eA2l77+fUIIyT4ido=' 
WHERE 
  key_id = '00b61aed052f54011bb6622000430967dc9c8f3e1d16c04add1bacf270c90eef' 
  AND (
    token = 'dlRuebbeTk8uebUpmHvPdos418eA2l77+fUIIyT4ido=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028