UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AjzY5otBDDQf2Imo9MAXJALqXF3IbenDGWm4OulIilY=' 
WHERE 
  key_id = '575ee2b562000d330b0ce801d859959306423ca9333a12c6c55857a4d9551f4e' 
  AND (
    token = 'AjzY5otBDDQf2Imo9MAXJALqXF3IbenDGWm4OulIilY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028