UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8p3iVE1oIwOsXppTR7B4yzht1rhJO4XDJvaWEzNaQfI=' 
WHERE 
  key_id = 'e4e0011c0de1c7ae967818b0a7d790f72a9e9028fdb2cbd7225d1c97eaa95271' 
  AND (
    token = '8p3iVE1oIwOsXppTR7B4yzht1rhJO4XDJvaWEzNaQfI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052